<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="./jquery-3.1.1.min.js" type="text/javascript"></script>
    </head>
    <body>
        标题：<input type="text" name="biaoti"/><span id="span1"></span><br/>
        内容：<br/><textarea id="wenzhang"></textarea><br/><span id="span2"></span><br/>
        <input type="button" name="button" value="提交"/>
        <script type="text/javascript">
            {literal}
            $("input[name=button]").click(function(){
               var biaoti=$("input[name=biaoti]").val();
               var wen=$("#wenzhang").val();
               if(biaoti==""){
                   $("#span1").css("color","red");
                   $("#span1").html("标题不能为空");
               }else if(wenzhang==""){
                   $("#span1").html("");
                   $("#span2").css("color","red");
                   $("#span2").html("内容不能为空");
               }
               $("#span2").html("");
               $.ajax({
                  type:"post",
                  url:"index.php?m=User&c=User&a=FT",
                  data:{biaoti:biaoti,wenzhang:wen},
                  success:function(a){
                     if(a==1){
                         window.location.href ="index.php?m=User&c=User&a=liebiao"; 
                     }
                  }
                     }); 
            });
            {/literal}
        </script>
    </body>
</html>
